import json
import redis

# 连接到 Redis
r = redis.Redis(host='localhost', port=6379, db=0)

# Python 字典
my_dict = {
    'name': 'Alice',
    'age': 30,
    'city': 'New York'
}

# 将字典序列化为 JSON 字符串
dict_json = json.dumps(my_dict)

# 存储到 Redis
r.set('J02E18468772', dict_json)

# 从 Redis 中读取并反序列化
stored_value = r.get('J02E18468772')
if stored_value:
    stored_dict = json.loads(stored_value.decode('utf-8'))
    print(stored_dict)